{% extends "publications/base1.html" %}
{% block head %}
{% load staticfiles %}	
<script type="text/javascript" language="javascript" src="{% static 'publications/js/jquery-1.10.1.min.js' %}"></script>
<script type="text/javascript" language="javascript" src="{% static 'publications/datatables/js/jquery.dataTables.min.js' %}"></script>
<link href="{% static 'publications/css/reset-min.css' %}" rel="stylesheet" type="text/css" />
<link href="{% static 'publications/datatables/css/prueba.css' %}" rel="stylesheet" type="text/css" />


<script type="text/javascript">
	$(document).ready(function() {
	    $('.dataTable').dataTable({
	    	'bAutoWidth': false,
	    	"sPaginationType": "full_numbers",
	    	"aLengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "TODO"]],
	    	"aaSorting": [[ 1, "desc" ]],
	    	"aoColumns": [
		        { "sWidth": "60%" },
		        { "sWidth": "20%" },
		        { "sWidth": "20%" },
		    ],
	    	"oLanguage": {
				"sLengthMenu": "Mostrando _MENU_ por pagina",
				"sZeroRecords": "No exiten publicaciones con el criterio de búsqueda.",
				"sInfo": "Mostrando _START_ a _END_ de _TOTAL_ autores",
				"sInfoEmpty": "Mostrando 0 a 0 de 0 autores",
				"sInfoFiltered": "(filtrados de un total de _MAX_ autores)",
				"sSearch": "Buscar:",
				"oPaginate": {
			        "sNext": "Siguiente",
			        "sLast": "Última",
			        "sPrevious": "Anterior",
			        "sFirst": "Primera"
			      }
			},
			"iDisplayLength": -1,
			//Callback function for calculating total cited count 
			//for table visible publications
			"fnFooterCallback": function( nFoot, aaData, iStart, iEnd, aiDisplay ) {
      			
				var iTotalCitations = 0;
				for(i=iStart; i<iEnd;i++){
					iTotalCitations += aaData[aiDisplay[i]][1]*1;
				}
				nFoot.getElementsByTagName('td')[0].innerHTML = iTotalCitations;
   			}
			//END CALBACK
	    });
	    showTables('WOK');
	} );
	
	
	function showTables(tableToShow) {

		$("#tableWOK").hide();
		$("#tableGScholar").hide();
		$("#tableScopus").hide();
		$(".btnWOK").attr('id', 'btnShowTable')
		$(".btnSCP").attr('id', 'btnShowTable')
		$(".btnGSC").attr('id', 'btnShowTable')

		if (tableToShow == 'WOK'){
			$("#tableWOK").show();
			$(".btnWOK").attr('id', 'btnSelected')
		}
		else if (tableToShow == 'scopus'){
			$("#tableScopus").show();
			$(".btnSCP").attr('id', 'btnSelected')
		}
		else if (tableToShow == 'gscholar'){
			$("#tableGScholar").show();
			$(".btnGSC").attr('id', 'btnSelected')
		}
	}
			
	function goBack() {
		window.history.back();
	}
</script>
{% endblock %}

{% block headerTitle %} {{author.surname | lower | capfirst}}, {{ author.name | lower | capfirst }} {% endblock %}
{% block content %}

<h3>Detalles del Autor</h3>
<table class="authorDetailsTable">
	<tr><th>Name:</th> <td>{{ author.name }} {{author.middle_name}}</td></tr>
	<tr><th>Last Name:</th><td> {{author.surname}} {{author.second_surname}}</td></tr>
	<tr><th>Category:</th><td>{{author.category}}</td></tr>
	<tr><th>Department:</th><td> {{author.department}}</td></tr>
	<tr><th>Gscholar ID:</th><td><a target="__blank" href="http://scholar.google.es/citations?user={{author.gscholar_id}}">{{author.gscholar_id}}</a> [h-index: {{author.gscholar_hindex}}]</td></tr>
	<tr><th>Scopus ID:</th><td><a target="__blank" href="http://www.scopus.com/authid/detail.url?authorId={{author.scopus_id}}">{{author.scopus_id}}</a> [h-index: {{author.scopus_hindex}}]</td></tr>
	<tr><th>WOK ID:</th><td><a target="__blank" href="http://www.researcherid.com/rid/{{author.wok_id}}">{{author.wok_id}}</a> [h-index: {{author.wok_hindex}}]</td></tr>
</table>
<div id="sourceSelector">
	<input id="btnShowTable" class='btnWOK' type="button" value="Publicaciones ISI WOK" onclick="showTables('WOK')">
	<input id="btnShowTable" class='btnSCP' type="button" value="Publicaciones Scopus" onclick="showTables('scopus')">
	<input id="btnShowTable" class='btnGSC' type="button" value="Publicaciones Google Scholar" onclick="showTables('gscholar')">
</div>

	<div id="tableWOK">
		<h3>Publicaciones ISI WOK (Total publicationes:{{ pubWOK.count }} - Total citas: {{author.wok_cit_count}} )</h3>
		<table cellpadding="0" cellspacing="0" border="0" class="pretty dataTable" id="pubWok">
		    <thead><tr><th>Titulo</th><th>Citas</th><th>Año</th></tr></thead>
		    <tbody>
		    {% for publication in pubWOK %}
		    	<tr>
		    		<th><a href="{% url 'publications.views.publicationDetails' publication.id %}">{{publication.title | truncatewords:"10"}}</a></th>
		    		<td>{{publication.times_cited}}</td>
		    		<td>{{publication.pub_date}}</td>
		    	</tr>
		    {% endfor %}
		    </tbody>
		     <tfoot><tr><th>TOTAL CITAS (total citas para las publicaciones mostradas)</th><td>{{author.wok_cit_count}}</td><td></td></tr></tfoot>
		</table>
	</div>
	
	<div id="tableScopus">
		<h3>Publicaciones SCOPUS (Total publicationes:{{ pubScopus.count }} - Total citas: {{author.scopus_cit_count}} )</h3>
		<table cellpadding="0" cellspacing="0" border="0" class="pretty dataTable" id="pubWok">
		    <thead><tr><th>Titulo</th><th>Citas</th><th>Año</th></tr></thead>
		    <tbody>
		    {% for publication in pubScopus %}
		    	<tr>
		    		<th><a href="{% url 'publications.views.publicationDetails' publication.id %}">{{publication.title | truncatewords:"10"}}</a></th>
		    		<td>{{publication.times_cited}}</td>
		    		<td>{{publication.pub_date}}</td>
		    	</tr>
		    {% endfor %}
		    </tbody>
		     <tfoot><tr><th>TOTAL CITAS (total citas para las publicaciones mostradas)</th><td>{{author.scopus_cit_count}}</td><td></td></tr></tfoot>
		</table>
	</div>
	
	<div id="tableGScholar">
		<h3>Publicaciones GOOGLE SCHOLAR (Total publicationes:{{ pubGScholar.count }} - Total citas: {{author.gscholar_cit_count}} )</h3>
		<table cellpadding="0" cellspacing="0" border="0" class="pretty dataTable" id="pubWok">
		    <thead><tr><th>Titulo</th><th>Citas</th><th>Año</th></tr></thead>
		    <tbody>
		    {% for publication in pubGScholar %}
		    	<tr>
		    		<th><a href="{% url 'publications.views.publicationDetails' publication.id %}">{{publication.title | truncatewords:"10"}}</a></th>
		    		<td>{{publication.times_cited}}</td>
		    		<td>{{publication.pub_date}}</td>
		    	</tr>
		    {% endfor %}
		    </tbody>
		    <tfoot><tr><th>TOTAL CITAS (total citas para las publicaciones mostradas)</th><td>{{author.gscholar_cit_count}}</td><td></td></tr></tfoot>
		</table>
	</div>
{% endblock %}